#ifndef DATABASES_H
#define DATABASES_H

#include <QObject>
#include <QObject>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QSqlRecord>
#include <QTextCodec>
#include "profiles.h"
#include "datastruct.h"

class Databases : public QObject
{
    Q_OBJECT
public:
    explicit Databases(QObject *parent = 0);
private:
    QSqlDatabase            db;
    DatabaseStruct          dbStruct;
public:
    QString openDatabase();
    bool isOpen();
public:
    QString saveConsumerDb(const ConsumerStruct &consumers) const;

    int getMaxConsumerNO() const;
    int saveConsumers(const ConsumerStruct &consumers) const;

    QString getConsumerNO(const ConsumerStruct &consumers) const;
    bool dealConsumers(const ConsumerStruct &consumers) const;
    QString saveConsumerOther(int consumerId,const ConsumerStruct &consumers) const;

    int consumerIsExists(const ConsumerStruct &consumers) const;
};

#endif // DATABASES_H
